﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/ado/2006/04/edm" 
           attributeFormDefault="unqualified" 
           elementFormDefault="qualified" 
           targetNamespace="http://schemas.microsoft.com/ado/2006/04/edm" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="Schema">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="EntityContainer">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element maxOccurs="unbounded" name="EntitySet">
                        <xs:complexType>
                           <xs:attribute name="Name" type="xs:string" use="required" />
                           <xs:attribute name="EntityType" type="xs:string" use="required" />
                        </xs:complexType>
                     </xs:element>
                     <xs:element maxOccurs="unbounded" name="AssociationSet">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element maxOccurs="unbounded" name="End">
                                 <xs:complexType>
                                    <xs:attribute name="Role" type="xs:string" use="required" />
                                    <xs:attribute name="EntitySet" type="xs:string" use="required" />
                                 </xs:complexType>
                              </xs:element>
                           </xs:sequence>
                           <xs:attribute name="Name" type="xs:string" use="required" />
                           <xs:attribute name="Association" type="xs:string" use="required" />
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
                  <xs:attribute name="Name" type="xs:string" use="required" />
               </xs:complexType>
            </xs:element>
            <xs:element maxOccurs="unbounded" name="EntityType">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="Key">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element maxOccurs="unbounded" name="PropertyRef">
                                 <xs:complexType>
                                    <xs:attribute name="Name" type="xs:string" use="required" />
                                 </xs:complexType>
                              </xs:element>
                           </xs:sequence>
                        </xs:complexType>
                     </xs:element>
                     <xs:element maxOccurs="unbounded" name="Property">
                        <xs:complexType>
                           <xs:attribute name="Name" type="xs:string" use="required" />
                           <xs:attribute name="Type" type="xs:string" use="required" />
                           <xs:attribute name="Nullable" type="xs:boolean" use="optional" />
                           <xs:attribute name="MaxLength" type="xs:unsignedInt" use="optional" />
                           <xs:attribute name="Unicode" type="xs:boolean" use="optional" />
                           <xs:attribute name="Precision" type="xs:unsignedByte" use="optional" />
                           <xs:attribute name="Scale" type="xs:unsignedByte" use="optional" />
                           <xs:attribute name="FixedLength" type="xs:boolean" use="optional" />
                        </xs:complexType>
                     </xs:element>
                     <xs:element minOccurs="0" maxOccurs="unbounded" name="NavigationProperty">
                        <xs:complexType>
                           <xs:attribute name="Name" type="xs:string" use="required" />
                           <xs:attribute name="Relationship" type="xs:string" use="required" />
                           <xs:attribute name="FromRole" type="xs:string" use="required" />
                           <xs:attribute name="ToRole" type="xs:string" use="required" />
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
                  <xs:attribute name="Name" type="xs:string" use="required" />
               </xs:complexType>
            </xs:element>
            <xs:element maxOccurs="unbounded" name="Association">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element maxOccurs="unbounded" name="End">
                        <xs:complexType>
                           <xs:sequence minOccurs="0">
                              <xs:element name="OnDelete">
                                 <xs:complexType>
                                    <xs:attribute name="Action" type="xs:string" use="required" />
                                 </xs:complexType>
                              </xs:element>
                           </xs:sequence>
                           <xs:attribute name="Role" type="xs:string" use="required" />
                           <xs:attribute name="Type" type="xs:string" use="required" />
                           <xs:attribute name="Multiplicity" type="xs:string" use="required" />
                        </xs:complexType>
                     </xs:element>
                     <xs:element minOccurs="0" name="ReferentialConstraint">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element name="Principal">
                                 <xs:complexType>
                                    <xs:sequence>
                                       <xs:element name="PropertyRef">
                                          <xs:complexType>
                                             <xs:attribute name="Name" type="xs:string" use="required" />
                                          </xs:complexType>
                                       </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="Role" type="xs:string" use="required" />
                                 </xs:complexType>
                              </xs:element>
                              <xs:element name="Dependent">
                                 <xs:complexType>
                                    <xs:sequence>
                                       <xs:element name="PropertyRef">
                                          <xs:complexType>
                                             <xs:attribute name="Name" type="xs:string" use="required" />
                                          </xs:complexType>
                                       </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="Role" type="xs:string" use="required" />
                                 </xs:complexType>
                              </xs:element>
                           </xs:sequence>
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
                  <xs:attribute name="Name" type="xs:string" use="required" />
               </xs:complexType>
            </xs:element>
         </xs:sequence>
         <xs:attribute name="Namespace" type="xs:string" use="required" />
         <xs:attribute name="Alias" type="xs:string" use="required" />
      </xs:complexType>
   </xs:element>
</xs:schema>